rem # https://docs.microsoft.com/zh-tw/windows-hardware/manufacture/desktop/configure-uefigpt-based-hard-drive-partitions rem # https://learn.microsoft.com/zh-tw/windows-hardware/manufacture/desktop/oem-deployment-of-windows-desktop-editions-sample-scripts?view=windows-11&preserve-view=true#-createpartitions-uefitxt rem == 2024-12-18 02:48:04 rem << DiskPart /s B:\CreatePartitions-UEFI_AnyDiskSize.txt >> rem == CreatePartitions-UEFI.txt == rem == These commands are used with DiskPart to rem create four partitions rem for a UEFI/GPT-based PC. rem Adjust the partition sizes to fill the drive rem as necessary. == rem ## select disk N0123 rem ## clean rem ## convert gpt rem == 1. Microsoft Reserved (MSR) partition ======= rem ---- For Windows 11 ---- rem # select partition 1 rem # delete partition override rem ---- For Windows 10 ---- rem #- create partition efi size=100 rem ** NOTE: For Advanced Format 4Kn drives, create partition msr size=16 rem == 2. System partition ========================= rem change this value to size = 260 ** create partition efi size=260 format quick fs=fat32 label="System" assign letter="S" NoErr rem #- rem #- == 2. Microsoft Reserved (MSR) partition ======= rem #- create partition msr size=16 rem == 3. Windows partition ======================== rem == a. Create the Windows partition ========== create partition primary rem == b. Create space for the recovery tools === rem ** Update this size to match the size of rem the recovery tools (winre.wim) rem plus some free space. rem #- shrink minimum=500 rem ==== shrink 32G+1G+2G=35G 1024*35=35840 MB shrink desired=35840 rem == c. Prepare the Windows partition ========= format quick fs=ntfs label="Windows" assign letter="W" NoErr rem == 4. Recovery partition ====================== rem #- create partition primary create partition primary size = 1024 format quick fs=ntfs label="Recovery" assign letter="R" NoErr set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac" rem 0x8000000000000000 (prevent assigning drive letter automatically on new machines) default rem 0x8000000000000001 (set as required partition by system) rem ## gpt attributes=0x8000000000000001 rem ==== 5. Restore partition ====================== create partition primary size = 32768 format quick fs=ntfs label="Restore" assign letter="T" NoErr rem ==== 6. Windows_PE partition ====================== create partition primary size = 2048 format quick fs=fat32 label="Windows_PE" assign letter="P" NoErr list volume list partition exit